#! /bin/bash
export LANG=zh_CN.UTF-8
PRESTO_HOME=/export/server/presto/bin/presto


${PRESTO_HOME} --catalog hive --server 192.168.88.80:8090 --execute "
insert into hive.edu_rpt.wf_rpt_cus_cnt_year
select
    year_code,
    origin_type,
    origin_channel,
    clue_state,
    area,
    center_name,
    school_id,
    school_name,
    subject_id,
    subject_name,
    time_type,
    group_type_new as group_type,
    rel_cnt
from hive.edu_dm.wf_dm_cus_rollup
where year_code is not null and time_type='year';

insert into hive.edu_rpt.wf_rpt_cus_cnt_month
select
    year_month,
    origin_type,
    origin_channel,
    clue_state,
    area,
    center_name,
    school_id,
    school_name,
    subject_id,
    subject_name,
    time_type,
    group_type_new as group_type,
    rel_cnt
from hive.edu_dm.wf_dm_cus_rollup
where year_month is not null and time_type='year_month' ;

insert into hive.edu_rpt.wf_rpt_cus_cnt_day
select
    dt,
    origin_type,
    origin_channel,
    clue_state,
    area,
    center_name,
    school_id,
    school_name,
    subject_id,
    subject_name,
    time_type,
    group_type_new as group_type,
    rel_cnt
from hive.edu_dm.wf_dm_cus_rollup
where dt is not null and time_type='day' ;

insert into hive.edu_rpt.wf_rpt_clu_hour
select dt,
       hr,
       clue_state,
       origin_type,
       clu_day_cnt,
       clu_hour_cnt,
       eff_hour_cnt,
       clu_hour_rate
from hive.edu_dm.wf_dm_clu_hour
;"